import cv2
import matplotlib.pyplot as plt

o = cv2.imread("D:\\xiuzhi2.jpg")
cv2.imshow("original",o)
plt.hist(o.ravel(),256)
cv2.waitKey()
cv2.destroyAllWindows()